const mongoose = require('mongoose');

const ConnectionSchema = new mongoose.Schema({
  id: {
    type: String,
    required: true,
    unique: true
  },
  from: {
    type: String,
    required: true
  },
  to: {
    type: String,
    required: true
  },
  fromSide: {
    type: String,
    required: true,
    enum: ['top', 'right', 'bottom', 'left']
  },
  toSide: {
    type: String,
    required: true,
    enum: ['top', 'right', 'bottom', 'left']
  },
  pathPoints: [{
    x: Number,
    y: Number
  }],
  tabId: {
    type: String,
    required: true
  }
});

module.exports = mongoose.model('Connection', ConnectionSchema);